#ifndef __BLOCK__
#define __BLOCK__

#ifndef byte
typedef unsigned char byte;
#endif

#include <cstring>

/// <summary>
/// A definition of a Minecraft block.
/// </summary>
class Block
{
public:
	/// <summary>
	/// An empty block, for comparison purposes.
	/// </summary>
	static const Block Empty;

	/// <summary>
	/// The ID of the block.
	/// </summary>
	int ID;

	/// <summary>
	/// The data/damage value of this block.
	/// </summary>
	byte Data;

	/// <summary>
	/// Initializes a new instance of the <see cref="Block" /> class, set to an Empty/AIR block.
	/// </summary>
	Block() :
		ID(0),
		Data(0)
	{
	}
	
	/// <summary>
	/// Initializes a new instance of the <see cref="Block" /> class from an ID/data pair.
	/// </summary>
	/// <param name="id">The id.</param>
	/// <param name="data">The data.</param>
	Block(const int &id, const byte &data) :
		ID(id),
		Data(data)
	{
	}

	/// <summary>
	/// Determines whether this Block is empty/AIR.
	/// </summary>
	/// <returns>True if the block is empty/AIR, false otherwise.</returns>
	inline bool IsEmpty() const { return *this == Empty; }

	inline void Set(const int &id, const byte &data)
	{
		ID = id;
		Data = data;
	}

	inline bool operator== (const Block &r) const
	{
		return (r.ID == 0 && r.ID == ID) || (Data == r.Data && ID == r.ID);
	}

	inline bool operator!= (const Block &r) const
	{
		return !operator==(r);
	}

};
#endif